﻿namespace Beeflys
{
    public abstract class AObject
    {
        internal void Constructor(ILogger logger)
        {
            string tag = this switch
            {
                AActor _ => "actor",
                AMessenger _ => "messenger",
                AComponent _ => "component",
                _ => string.Empty
            };

            this.Logger = logger;
            this.objectDescribe = $"{tag}:{this.GetType().FullName}";

            this.IsActive = true;
        }

        internal virtual void Destructor()
        {
            this.Logger = null;
            this.IsActive = false;
            this.objectDescribe = string.Empty;
        }

        private string objectDescribe;

        public bool IsActive
        {
            get;
            internal set;
        }

        public ILogger Logger
        {
            get; private set;
        }

        public override string ToString()
        {
            return this.objectDescribe;
        }
    }
}